<template>
  <div>
    <van-picker
      show-toolbar title="服务区域"
      :columns="columns"
      @confirm="onConfirm"
      @cancel="$emit('close')"
    />
  </div>
</template>

<script>
export default {
  data () {
    return {
      // zone: [],
      columns: [
        {
          text: '湖南',
          children: [
            {
              text: '长沙',
              children: [{ text: '岳麓区' }, { text: '望城' }]
            },
            {
              text: '娄底',
              children: [{ text: '娄星区' }, { text: '冷水江' }]
            }
          ]
        }
      ]
    }
  },
  created () {

  },
  mounted () {

  },
  methods: {
    onConfirm (value, index) {
      var sum = value.reduce(function (prev, cur, index, arr) {
        return prev + cur
      })
      this.$emit('onComfirmZone', sum)
      console.log(sum)
    }
  }
}
</script>

<style scoped lang="less">

</style>
